Skip to content

Core - Add chrome_policy_id to CefSettings#5227

Merged
amaitland merged 2 commits intocefsharp:masterfrom
strau0106:master
Mar 27, 2026
Merged

Core - Add chrome_policy_id to CefSettings#5227
amaitland merged 2 commits intocefsharp:masterfrom
strau0106:master

Conversation

@strau0106
Copy link
Copy Markdown
Contributor

@strau0106 strau0106 commented Mar 25, 2026

Summary:
Cef allows a chrome_policy_id to be set, to allow for an enterprise policy to be set. Cef introduced this feature here

Changes:
I added a ChromePolicyID field to the relevant locations, to allow this id to be set in the cef_settings object.

How Has This Been Tested?

I tested if the policies are loaded, which they are. To test chrome policy commandline argument also has to be set.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Updated documentation

Checklist:

  • Tested the code(if applicable)
  • Commented my code
  • Changed the documentation(if applicable)
  • The formatting is consistent with the project (project supports .editorconfig)

Summary by CodeRabbit

  • New Features
    • Added a new ChromePolicyId setting to application settings, allowing administrators and users to specify a Chrome policy identifier for the app. This enables passing and persisting a Chrome policy ID through the app's configuration, improving policy-based configuration and integration with Chrome-related controls.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 534fe1fc-4f97-4af4-aade-9d6244329515

📥 Commits

Reviewing files that changed from the base of the PR and between 55b4bd8 and f438e4a.

📒 Files selected for processing (1)
  • CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs
✅ Files skipped from review due to trivial changes (1)
  • CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs

📝 Walkthrough

Walkthrough

Added a public ChromePolicyId property to CefSettingsBase in managed (C#) and C++/CLR layers, wiring it to the native chrome_policy_id field with CLR-to-native and native-to-CLR string conversions.

Changes

Cohort / File(s) Summary
C++/CLR interop
CefSharp.Core.Runtime/CefSettingsBase.h
Added property String^ ChromePolicyId with getter reading _cefSettings->chrome_policy_id via StringUtils::ToClr and setter assigning via StringUtils::AssignNativeFromClr.
Managed C# implementation
CefSharp.Core/CefSettingsBase.cs
Added public string ChromePolicyId { get; set; } forwarding to underlying settings.
Reference assembly
CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs
Added public string ChromePolicyId property signature (get { throw null; } set { }) to the ref assembly.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A tiny ID hops into place,
Between native roots and managed space,
I bound the strings with care and cheer,
Now Chrome's policy whispers near,
Hooray — a small change, crisp and clear! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and directly summarizes the main change: adding a chrome_policy_id property to CefSettings.
Description check ✅ Passed The description covers required sections including summary, changes, testing details, and type classification, though testing section lacks comprehensive environment details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AppVeyorBot
Copy link
Copy Markdown

@amaitland
Copy link
Copy Markdown
Member

Great, thanks for the PR. I think the ref assembly for netcore needs to be regenerated.

https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs

Building the net core solution should regenerate it, if not delete the file and build again.

@strau0106
Copy link
Copy Markdown
Contributor Author

Hi, Thanks for the prompt response! I regened the file now, and added it.

@AppVeyorBot
Copy link
Copy Markdown

@amaitland amaitland merged commit 6381ab2 into cefsharp:master Mar 27, 2026
1 of 2 checks passed
@amaitland
Copy link
Copy Markdown
Member

Nice, thanks. Will be in the 146 release which will hopefully be out in a day or two.

@amaitland amaitland added this to the 146.0.x milestone Mar 27, 2026
@strau0106
Copy link
Copy Markdown
Contributor Author

Thanks a lot for the swift merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants